package xin.yangshuai.basic01.str;

/**
 * Encoding
 *
 * @author shuai
 * @date 2024/2/5
 */
public class Encoding {

    public static void main(String[] args) {
        String s = "中文";
        byte[] bytes = s.getBytes();
        for (byte aByte : bytes) {
            int a = aByte;
            if (a < 0) {
                a = a + 256;
            }

            String[] str = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"};

            int b = a / 16;
            int c = a % 16;

            System.out.println(str[b] + str[c]);
        }
    }
}
